< previous page page_660 next page >

Page 660
The following Visual Basic code fragment folds up the cubes to create the hypercube. Code related to the projection that allows you to view the hypercube and code related to animation details have been omitted. The cubes are numbered as shown in Figure 18.11. Cube 3 sits in the middle between cubes 2 and 4.
e10a6a0a59f035e870d90cca05b85fce.gif
' Fold up cube 5.
Set col = New Collection
col.Add TheCubes(5)
FoldYW col, 1, 0, PI / 2
If Not Running Then Exit Sub

' Fold up cube 6.
Set col = New Collection
col.Add TheCubes(6)
FoldZW col, -1, 0, -PI / 2
If Not Running Then Exit Sub

' Fold up cube 4.
Set col = New Collection
col.Add TheCubes(4)
FoldXW col, 1, 0, PI / 2
If Not Running Then Exit Sub

' Fold up cube 7.
Set col = New Collection
col.Add TheCubes(7)
FoldYW col, -1, 0, -PI / 2
If Not Running Then Exit Sub

' Fold up cube 8.
Set col = New Collection
col.Add TheCubes(8)
FoldZW col, 1, 0, PI / 2
If Not Running Then Exit Sub

' Fold up cubes 2 and 1 together.
Set col = New Collection
col.Add TheCubes(1)
col.Add TheCubes(2)
FoldXW col, -1, 0, -PI / 2
If Not Running Then Exit Sub

' Finish folding cube 1.
Set col = New Collection
col.Add TheCubes(1)
FoldXW col, 1, 2, -PI / 2
If Not Running Then Exit Sub

 
< previous page page_660 next page >